package com.bsj.power.common.def.entity.personGroup;

import com.bsj.power.common.constant.NumericalConstants;
import com.bsj.power.common.def.entity.job.WorkPersonnel;
import com.bsj.power.common.def.entity.personnel.Personnel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author yinhao
 * @version 1.0
 * @description 作业人员跟负责人绑定人员分组的信息
 * @date 2024/9/15
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BindPersonGroup {


    /**
     * 组id
     */
    private Integer groupId;
    /**
     * 人员ID
     */
    private Integer personnelId;
    /**
     * 人员类型 1负责人 2作业人员
     */
    private Integer personnelType;
    /**
     * 工号
     */
    private String empNo;
    /**
     * 时间
     */
    private Date time;

    public BindPersonGroup(Personnel personnel) {
        this.groupId = personnel.getGroupId();
        this.personnelId = personnel.getPersonnelId();
        this.personnelType = NumericalConstants.ONE;
        this.empNo = personnel.getEmpNo();
        this.time = new Date();
    }

    public BindPersonGroup(WorkPersonnel workPersonnel) {
        this.groupId = workPersonnel.getGroupId();
        this.personnelId = workPersonnel.getWorkPersonnelId();
        this.personnelType = NumericalConstants.TWO;
        this.empNo = workPersonnel.getTemporaryEmpNo();
        this.time = new Date();
    }
}
